<!DOCTYPE html>
<html lang="en">

	<include file="Public:header" />
	<include file="Public:page_css" />
	<style>
		.tree ul li{ list-style-type:none;}
	</style>

	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<include file="Public:nav" />
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content no-padding">
						<ul class="list-group">
							<li class="list-group-item">
								<p class="text-success"><a href="{:U('Index/index')}" title="返回首页" class="tip-bottom"><i class="fa fa-home"></i> 首页</a> /
									<a href="#" class="tip-bottom">系统管理</a> /
									<a href="{:U('System/role')}" class="tip-bottom">角色管理</a> /
									<a href="#" class="tip-bottom">权限管理</a>
								</p>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>权限管理</h5>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					
					<div class="ibox-content">
						<form class="form-horizontal" method="post" action="{:U('System/setting')}" name="basic_validate" id="basic_validate">
							<div class="tree">
								<ul>
									<li>
										<volist name="list" id="vo">
											<if condition="$vo['pid'] eq 0">
												<input type="checkbox" name="rule[]" id="ckall" onclick="checkAll();" value="{$vo.id}">{$vo.title}
												<ul>
													<volist name="list" id="menu">
														<if condition="$menu['pid'] eq $vo['id']">
															<li>
																<input type="checkbox" name="rule[]" id="{$menu.id}" value="{$menu.id}" <php>if(strpos($group,'#'.$menu['id'].'#')>-1){echo "checked";} </php>>{$menu.title}
																<eq name="menu['menuflag']" value="1">(菜单)
																	<else/>(功能)</eq>
																<ul>
																	<volist name="list" id="sons">
																		<if condition="$sons['pid'] eq $menu['id']">
																			<li>
																				<input type="checkbox" name="rule[]" id="{$sons.id}" value="{$sons.id}" <php>if(strpos($group,'#'.$sons['id'].'#')>-1){echo "checked";} </php>>{$sons.title}
																				<eq name="sons['menuflag']" value="1">(菜单)
																					<else/>(功能)</eq>
																			</li>
																		</if>
																	</volist>
																</ul>
															</li>
														</if>
													</volist>
												</ul>
											</if>
										</volist>
									</li>
								</ul>
							</div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-2">
									<input type="hidden" name="id" value="{$role}">
									<input type="submit" value="保存内容" class="btn btn-primary">
									<a class="btn btn-white" href="{:U('System/role')}">取消</a>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<include file="Public:footer" />
	</body>

</html>

<script type="text/javascript">
	function checkAll(){
	      
	    if($('#ckall').prop('checked')){
	            //全选
	            $(':checkbox').prop('checked',true);
	            $(':checkbox').each(function(){
	                            $(this).parent().addClass('checked');
	                    })
	    }else{
	            //反选
	            $(':checkbox').prop('checked',false);
	            $(':checkbox').each(function(){
	                    $(this).parent().removeClass('checked');
	            })
	
	    }
		
	}
</script>